import { post } from "@/api/axios"
import type { BiuJsonResult } from "@/api/biu-json-result"

export interface LoginRequest {
  username: string
  password: string
}

export interface ChangePasswordRequest {
  oldPassword: string
  newPassword: string
}

export function doLogin(request: LoginRequest) {
  return post<BiuJsonResult<string>>("/api/passport/login", request)
}

export function doIsLogin() {
  return post<BiuJsonResult<boolean>>("/api/passport/is-login")
}

export function doLogout() {
  return post("/api/passport/logout")
}

export function doChangePassword(request: ChangePasswordRequest) {
  return post<BiuJsonResult<boolean>>("/api/passport/change-password", request)
}
